import asyncio
import ygg_aiomysql as aiomysql

async def main():
    """
    示例06：查询MySQL服务器上的所有数据库
    """
    # 创建连接池
    pool = await aiomysql.new_pool(password="zhangdapeng520")
    
    try:
        # 获取所有数据库
        databases = await aiomysql.get_all_databases(pool)
        
        # 打印数据库列表
        print("MySQL服务器上的数据库:")
        for db in databases:
            print(f"- {db}")
    finally:
        # 关闭连接池
        pool.close()
        await pool.wait_closed()

if __name__ == "__main__":
    asyncio.run(main())